<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>多人订票</title>
    </head>
    <body>
        <div class="x-form-item">
            <form name="form1" action="/orders/saveMulOrder">
                <input type="hidden" name="customerid" value="<%=@customer.id%>"><input type="hidden" name="airNo" value="<%=@airNo%>"><input type="hidden" name="position" value="<%=@position%>"><input type="hidden" name="fromto" value="<%=@fromto%>"><input type="hidden" name="fly_date" value="<%=@fly_date%>"><input type="hidden" name="fly_time" value="<%=@fly_time%>"><input type="hidden" name="arr_time" value="<%=@arr_time%>"><input type="hidden" name="plane_type" value="<%=@plane_type%>"><input type="hidden" name="price" value="<%=@price%>"><% if @trip_type %>
                <input type="hidden" name="trip_type" value="<%=@trip_type%>"><input type="hidden" name="airNo2" value="<%=@airNo2%>"><input type="hidden" name="position2" value="<%=@position2%>"><input type="hidden" name="fromto2" value="<%=@fromto2%>"><input type="hidden" name="fly_date2" value="<%=@fly_date2%>"><input type="hidden" name="fly_time2" value="<%=@fly_time2%>"><input type="hidden" name="arr_time2" value="<%=@arr_time2%>"><input type="hidden" name="plane_type2" value="<%=@plane_type2%>"><input type="hidden" name="price2" value="<%=@price2%>"><% end %>
                <table width="880" border="0" class="admin">
                    <tr>
                        <td width="70" align="right">
                            客户：
                        </td>
                        <td width="250">
                            <%=@customer.name %>
                        </td>
                        <td width="70" align="right">
                        </td>
                        <td width="170">
                        </td>
                        <td width="70" align="right">
                        </td>
                        <td width="">
                        </td>
                        <td width="70" align="right">
                        </td>
                        <td width="">
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            航班信息：
                        </td>
                        <td colspan="7">
                            <%=@airNo %>&nbsp;<%=@fly_date %>&nbsp;<%=@position %>舱&nbsp;<%=@from_city %>&nbsp;<%=@fly_time %>&nbsp;<%=@to_city %>&nbsp;<%=@arr_time %>&nbsp;<%=@plane_type %>&nbsp;
                            <font color="red">
                                <%=@price %>.00
                            </font>元
                        </td>
                    </tr>
                    <% if @trip_type %>
                    <tr>
                        <td align="right">
                            返程/联程：
                        </td>
                        <td colspan="7">
                            <%=@airNo2 %>&nbsp;<%=@fly_date2 %>&nbsp;<%=@position2 %>舱&nbsp;<%=@from_city2 %>&nbsp;<%=@fly_time2 %>&nbsp;<%=@to_city2 %>&nbsp;<%=@arr_time2 %>&nbsp;<%=@plane_type2 %>&nbsp;
                            <font color="red">
                                <%=@price2 %>.00
                            </font>元
                        </td>
                    </tr>
                    <% end %>
                    <tr>
                        <td align="right">
                            出票状态：
                        </td>
                        <td>
                            <input id="status" name="status" type="text" value=""/>
                        </td>
                        <td align="right">
                            出票类型：
                        </td>
                        <td>
                            <input id="fix_type" name="fix_type" type="radio" value="HK" checked="checked" onclick="radioCheck('HK')"/>HK
                            &nbsp;<input id="fix_type" name="fix_type" type="radio" value="RR" onclick="radioCheck('RR')"/>RR
							&nbsp;<input id="fix_type" name="fix_type" type="radio" value="LL" onclick="radioCheck('LL')"/>LL
							
                        </td>
                        <td align="right">
                            客户要求：
                        </td>
                        <td colspan="3">
                            <input id="order_request" name="order_request" size="40" type="text" value=""/>
                        </td>
                    </tr>
                    <tr id="tktl_tr" style="display:">
                        <td align="right">
                            <font color="red">
                                *
                            </font>时限日期：
                        </td>
                        <td>
                            <input id="tktl_date" name="tktl_date" type="text" value=""/>
                        </td>
                        <td align="right">
                            <font color="red">
                                *
                            </font>时限时间：
                        </td>
                        <td>
                            <input id="tktl_time" name="tktl_time" type="text" value=""/>
                        </td>
                        <td align="right">
                            <font color="red">
                                *
                            </font>COF：
                        </td>
                        <td>
                            <input id="affirm_date" name="affirm_date" type="text" value=""/>
                        </td>
                    </tr>
                    <tr id="ticket_no_tr" style="display:none">
                        <td align="right">
                            <font color="red">
                                *
                            </font>票号：
                        </td>
                        <td>
                            <input id="ticket_no" name="ticket_no" type="text" value=""/>
                        </td>
                        <td colspan="6">
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            <font color="red">
                                *
                            </font>联系人：
                        </td>
                        <td>
                            <input id="mul_link_man" name="mul_link_man" type="text" value="<%=@customer.linkman%>"/>
                        </td>
                        <td align="right">
                            <font color="red">
                                *
                            </font>联系电话：
                        </td>
                        <td>
                            <input id="mul_link_tel" name="mul_link_tel" type="text" value="<%=@customer.linkman_phone%>"/>
                        </td>
                        <td align="right">
                            送票地址：
                        </td>
                        <td colspan="3">
                            <input id="send_address" name="send_address" size="40" type="text" value=""/>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            送票日期：
                        </td>
                        <td>
                            <input id="send_date" name="send_date" type="text" value=""/>
                        </td>
                        <td align="right">
                            送票时间：
                        </td>
                        <td>
                            <input id="send_time" name="send_time" type="text" value=""/>
                        </td>
                        <td align="right">
                            送票要求：
                        </td>
                        <td colspan="3">
                            <input id="send_request" name="send_request" size="40" type="text" value=""/>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            接机时间：
                        </td>
                        <td>
                            <input id="jj_time" name="jj_time" type="text" value=""/>
                        </td>
                        <td align="right">
                            接机要求：
                        </td>
                        <td>
                            <input id="jj_request" name="jj_request" type="text" value=""/>
                        </td>
                        <td align="right">
                            接机地址：
                        </td>
                        <td colspan="3">
                            <input id="jj_address" name="jj_address" size="40" type="text" value="<%=Constants::DEFAULT_JJ_ADDRESS%>"/>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            座位数： 
                        </td>
                        <td>
                        <select id="seat" name="seat" onchange="changeSeat()"/><% for i in 1..9 %>
                        <option value="<%=i%>"><%=i %></option>
                        <% end %>
                        </select>
                    </td>
                    <td align="right">
                        拥有者：
                    </td>
                    <td>
                        <input id="owner" name="owner" type="text" value=""/>
                    </td>
                    <td colspan="4">
                    </td>
                    </tr>
                </table>
                <table width="880" border="0" class="admin">
                    <tr>
                        <td align="right">
                            乘客姓名：
                        </td>
                        <td>
                            <input id="pass_name" name="pass_name" type="text" value=""/>
                        </td>
                        <td align="right">
                            证件号码：
                        </td>
                        <td>
                            <input id="pass_idcard" name="pass_idcard" type="text" value=""/>
                        </td>
                        <td align="right">
                            联系电话：
                        </td>
                        <td>
                            <input id="pass_tel" name="pass_tel" type="text" size="11" value=""/>
                        </td>
                        <td>
                            <select id="human_type" name="human_type">
                                <option value="">成人</option>
                                <option value="chd">儿童</option>
                            </select>
                        </td>
                        <td align="right">
                            出生日期：
                        </td>
                        <td>
                            <input id="chd_date" name="chd_date" type="text" value=""/>
                        </td>
                        <td align="right">
                            保险份数：
                        </td>
                        <td>
                            <select id="insurance_number" name="insurance_number">
                                <option value="0">0</option>
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                            </select>
                        </td>
                    </tr>
                    <tr id="pass1" style="display:none">
                        <td align="right">
                            乘客姓名：
                        </td>
                        <td>
                            <input id="pass_name1" name="pass_name1" type="text" value=""/>
                        </td>
                        <td align="right">
                            证件号码：
                        </td>
                        <td>
                            <input id="pass_idcard1" name="pass_idcard1" type="text" value=""/>
                        </td>
                        <td align="right">
                            联系电话：
                        </td>
                        <td>
                            <input id="pass_tel1" name="pass_tel1" type="text" size="11" value=""/>
                        </td>
                        <td>
                            <select id="human_type1" name="human_type1">
                                <option value="">成人</option>
                                <option value="chd">儿童</option>
                            </select>
                        </td>
                        <td align="right">
                            出生日期：
                        </td>
                        <td>
                            <input id="chd_date1" name="chd_date1" type="text" value=""/>
                        </td>
                        <td align="right">
                            保险份数：
                        </td>
                        <td>
                            <select id="insurance_number1" name="insurance_number1">
                                <option value="0">0</option>
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                            </select>
                        </td>
                    </tr>
                    <tr id="pass2" style="display:none">
                        <td align="right">
                            乘客姓名：
                        </td>
                        <td>
                            <input id="pass_name2" name="pass_name2" type="text" value=""/>
                        </td>
                        <td align="right">
                            证件号码：
                        </td>
                        <td>
                            <input id="pass_idcard2" name="pass_idcard2" type="text" value=""/>
                        </td>
                        <td align="right">
                            联系电话：
                        </td>
                        <td>
                            <input id="pass_tel2" name="pass_tel2" type="text" size="11" value=""/>
                        </td>
                        <td>
                            <select id="human_type2" name="human_type2">
                                <option value="">成人</option>
                                <option value="chd">儿童</option>
                            </select>
                        </td>
                        <td align="right">
                            出生日期：
                        </td>
                        <td>
                            <input id="chd_date2" name="chd_date2" type="text" value=""/>
                        </td>
                        <td align="right">
                            保险份数：
                        </td>
                        <td>
                            <select id="insurance_number2" name="insurance_number2">
                                <option value="0">0</option>
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                            </select>
                        </td>
                    </tr>
                    <tr id="pass3" style="display:none">
                        <td align="right">
                            乘客姓名：
                        </td>
                        <td>
                            <input id="pass_name3" name="pass_name3" type="text" value=""/>
                        </td>
                        <td align="right">
                            证件号码：
                        </td>
                        <td>
                            <input id="pass_idcard3" name="pass_idcard3" type="text" value=""/>
                        </td>
                        <td align="right">
                            联系电话：
                        </td>
                        <td>
                            <input id="pass_tel3" name="pass_tel3" type="text" size="11" value=""/>
                        </td>
                        <td>
                            <select id="human_type3" name="human_type3">
                                <option value="">成人</option>
                                <option value="chd">儿童</option>
                            </select>
                        </td>
                        <td align="right">
                            出生日期：
                        </td>
                        <td>
                            <input id="chd_date3" name="chd_date3" type="text" value=""/>
                        </td>
                        <td align="right">
                            保险份数：
                        </td>
                        <td>
                            <select id="insurance_number3" name="insurance_number3">
                                <option value="0">0</option>
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                            </select>
                        </td>
                    </tr>
                    <tr id="pass4" style="display:none">
                        <td align="right">
                            乘客姓名：
                        </td>
                        <td>
                            <input id="pass_name4" name="pass_name4" type="text" value=""/>
                        </td>
                        <td align="right">
                            证件号码：
                        </td>
                        <td>
                            <input id="pass_idcard4" name="pass_idcard4" type="text" value=""/>
                        </td>
                        <td align="right">
                            联系电话：
                        </td>
                        <td>
                            <input id="pass_tel4" name="pass_tel4" type="text" size="11" value=""/>
                        </td>
                        <td>
                            <select id="human_type4" name="human_type4">
                                <option value="">成人</option>
                                <option value="chd">儿童</option>
                            </select>
                        </td>
                        <td align="right">
                            出生日期：
                        </td>
                        <td>
                            <input id="chd_date4" name="chd_date4" type="text" value=""/>
                        </td>
                        <td align="right">
                            保险份数：
                        </td>
                        <td>
                            <select id="insurance_number4" name="insurance_number4">
                                <option value="0">0</option>
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                            </select>
                        </td>
                    </tr>
                    <tr id="pass5" style="display:none">
                        <td align="right">
                            乘客姓名：
                        </td>
                        <td>
                            <input id="pass_name5" name="pass_name5" type="text" value=""/>
                        </td>
                        <td align="right">
                            证件号码：
                        </td>
                        <td>
                            <input id="pass_idcard5" name="pass_idcard5" type="text" value=""/>
                        </td>
                        <td align="right">
                            联系电话：
                        </td>
                        <td>
                            <input id="pass_tel5" name="pass_tel5" type="text" size="11" value=""/>
                        </td>
                        <td>
                            <select id="human_type5" name="human_type5">
                                <option value="">成人</option>
                                <option value="chd">儿童</option>
                            </select>
                        </td>
                        <td align="right">
                            出生日期：
                        </td>
                        <td>
                            <input id="chd_date5" name="chd_date5" type="text" value=""/>
                        </td>
                        <td align="right">
                            保险份数：
                        </td>
                        <td>
                            <select id="insurance_number5" name="insurance_number5">
                                <option value="0">0</option>
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                            </select>
                        </td>
                    </tr>
                    <tr id="pass6" style="display:none">
                        <td align="right">
                            乘客姓名：
                        </td>
                        <td>
                            <input id="pass_name6" name="pass_name6" type="text" value=""/>
                        </td>
                        <td align="right">
                            证件号码：
                        </td>
                        <td>
                            <input id="pass_idcard6" name="pass_idcard6" type="text" value=""/>
                        </td>
                        <td align="right">
                            联系电话：
                        </td>
                        <td>
                            <input id="pass_tel6" name="pass_tel6" type="text" size="11" value=""/>
                        </td>
                        <td>
                            <select id="human_type6" name="human_type6">
                                <option value="">成人</option>
                                <option value="chd">儿童</option>
                            </select>
                        </td>
                        <td align="right">
                            出生日期：
                        </td>
                        <td>
                            <input id="chd_date6" name="chd_date6" type="text" value=""/>
                        </td>
                        <td align="right">
                            保险份数：
                        </td>
                        <td>
                            <select id="insurance_number6" name="insurance_number6">
                                <option value="0">0</option>
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                            </select>
                        </td>
                    </tr>
                    <tr id="pass7" style="display:none">
                        <td align="right">
                            乘客姓名：
                        </td>
                        <td>
                            <input id="pass_name7" name="pass_name7" type="text" value=""/>
                        </td>
                        <td align="right">
                            证件号码：
                        </td>
                        <td>
                            <input id="pass_idcard7" name="pass_idcard7" type="text" value=""/>
                        </td>
                        <td align="right">
                            联系电话：
                        </td>
                        <td>
                            <input id="pass_tel7" name="pass_tel7" type="text" size="11" value=""/>
                        </td>
                        <td>
                            <select id="human_type7" name="human_type7">
                                <option value="">成人</option>
                                <option value="chd">儿童</option>
                            </select>
                        </td>
                        <td align="right">
                            出生日期：
                        </td>
                        <td>
                            <input id="chd_date7" name="chd_date7" type="text" value=""/>
                        </td>
                        <td align="right">
                            保险份数：
                        </td>
                        <td>
                            <select id="insurance_number7" name="insurance_number7">
                                <option value="0">0</option>
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                            </select>
                        </td>
                    </tr>
                    <tr id="pass8" style="display:none">
                        <td align="right">
                            乘客姓名：
                        </td>
                        <td>
                            <input id="pass_name8" name="pass_name8" type="text" value=""/>
                        </td>
                        <td align="right">
                            证件号码：
                        </td>
                        <td>
                            <input id="pass_idcard8" name="pass_idcard8" type="text" value=""/>
                        </td>
                        <td align="right">
                            联系电话：
                        </td>
                        <td>
                            <input id="pass_tel8" name="pass_tel8" type="text" size="11" value=""/>
                        </td>
                        <td>
                            <select id="human_type8" name="human_type8">
                                <option value="">成人</option>
                                <option value="chd">儿童</option>
                            </select>
                        </td>
                        <td align="right">
                            出生日期：
                        </td>
                        <td>
                            <input id="chd_date8" name="chd_date8" type="text" value=""/>
                        </td>
                        <td align="right">
                            保险份数：
                        </td>
                        <td>
                            <select id="insurance_number8" name="insurance_number8">
                                <option value="0">0</option>
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td colspan="7">
                            <input type="button" value=" 提 交 " onclick="submitOrder()">
                        </td>
                    </tr>
                </table>
            </form>
        </div>
        <script>
            var addMul_cid = "<%=@customer.id%>";
            var customer_address = '<%=@customer.address%>';
            function changeSeat(){
                var l = parseInt($('seat').value);
                for (i = 1; i < 9; i++) {
                    if (i < l) {
                        $('pass' + i).style.display = '';
                    }
                    else {
                        $('pass' + i).style.display = 'none';
                    }
                }
            }
            
            function radioCheck(type){
                if (type == "HK" || type == "LL") {
                    $('tktl_tr').style.display = "";
                    $('tktl_tr').style.display = "";
                    $('ticket_no_tr').style.display = "none";
                }
                else {
                    $('tktl_tr').style.display = "none";
                    $('tktl_tr').style.display = "none";
                    $('ticket_no_tr').style.display = "";
                }
            }
            
            function submitOrder(){
                var submitFlag = true;
                var l = parseInt($('seat').value);
                for (i = 0; i < l; i++) {
                    if (i == 0) {
                        if ($('pass_name').value == "") {
                            Ext.MessageBox.alert('提示', '乘客姓名没有填写.');
                            submitFlag = false;
                            break;
                        }
                        else if ($('human_type').value == "chd" && $('chd_date').value == "") {
                            Ext.MessageBox.alert('提示', '儿童的出生日期没有选择.');
                            submitFlag = false;
                            break;
                        }
                    }
                    else {
                        if ($('pass_name' + i).value == "") {
                            Ext.MessageBox.alert('提示', '第' + (i + 1) + '个乘客姓名没有填写.');
                            submitFlag = false;
                            break;
                        }
                        else if ($('human_type' + i).value == "chd" && $('chd_date' + i).value == "") {
                            Ext.MessageBox.alert('提示', '第' + (i + 1) + '位的儿童的出生日期没有选择.');
                            submitFlag = false;
                            break;
                        }
                    }
                }
                if (submitFlag) {
                    var fix_types = document.getElementsByName('fix_type');
                    if (fix_types[0].checked) {
                        if ($('tktl_date').value == "") {
                            Ext.MessageBox.alert('提示', '出票时限日期必须选择.');
                            submitFlag = false;
                        }
                    }
                    else {
                        if ($('ticket_no').value == "") {
                            Ext.MessageBox.alert('提示', '票号不能为空.');
                            submitFlag = false;
                        }
                    }
                }
                if (submitFlag) {
                    if ($('affirm_date').value == "") {
                        Ext.MessageBox.alert('提示', 'COF确认日期必须选择.');
                        submitFlag = false;
                    }
                    else if ($('mul_link_man').value == "") {
                        Ext.MessageBox.alert('提示', '联系人必须填写.');
                        submitFlag = false;
                    }
                    else if ($('mul_link_tel').value == "") {
                        Ext.MessageBox.alert('提示', '联系电话必须填写.');
                        submitFlag = false;
                    }
                }
				
                if (submitFlag) {
                    Ext.Ajax.request({
                        url: '/orders/saveMulOrder',
                        params: Form.serialize("form1"),
                        method: 'GET',
                        success: function(result, request){
                            if (result.responseText.indexOf("成功") >= 0) {
                                Ext.MessageBox.alert('操作成功', '提交订单成功 -- 将转回来电显示页面');
                                //Ext.MessageBox.alert('操作信息', result.responseText);
                                Ext.getCmp('tabs').activate("phoneshow_tab0");
                                var url = '/customers/customerInfoByID';
                                Ext.getCmp('phoneshow_tab0').getUpdater().update(url);
                            }
                            else {
                                Ext.MessageBox.alert('操作失败', result.responseText);
                            }
                        },
                        failure: function(result, request){
                            Ext.MessageBox.alert('操作信息', '提交订票信息失败 -- ' + result.responseText);
                        }
                    });
                }
                
            }
            
            Ext.onReady(function(){
            
                var status = new Ext.form.ComboBox({
                    store: new Ext.data.Store({
                        reader: new Ext.data.ArrayReader({}, ['value']),
                        data: [[TICKET_STATUS_WQR], [TICKET_STATUS_QRCP], [TICKET_STATUS_LJCP]]
                    }),
                    name: 'status',
                    fieldLabel: '出票状态',
                    resiable: true,
                    typeAhead: true,
                    width: 90,
                    handleHeight: 100,
                    displayField: 'value',
                    valueField: 'value',
                    nameField: 'status',
                    selectOnFocus: true,
                    mode: 'local',
                    selectOnFocus: true,
                    triggerAction: 'all', //这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    emptyText: '选择类型...',
                    //allowBlank: false,
                    //blankText: "出票状态必须选择",
                    applyTo: 'status',
                    value: TICKET_STATUS_WQR
                });
                var tktl_date = new Ext.form.DateField({
                    //fieldLabel: '出票时限',
                    name: 'tktl_date',
                    format: 'Y-m-d', //格式化日期
                    //disabledDays: [0,6],	//不让选择周六，周日
                    //disabledDaysText: "周末要休息",
                    invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
                    allowBlank: false,
                    blankText: "出票时限不允许为空",
                    //emptyText: '请选择...',
                    inputType: '2008-01-01',
                    applyTo: 'tktl_date',
                    editable: false,
                    minValue: today,
                    //anchor: '50%'
                    width: 90
                });
                var tktl_time = new Ext.form.TimeField({
                    fieldLabel: '时间',
                    name: 'tktl_time',
                    altFormats: 'H:i',
                    format: 'H:i',
                    increment: 60,
                    //minValue: '08:00',
                    //maxValue: '18:00',
                    applyTo: 'tktl_time',
                    editable: false,
                    //anchor: '50%'
                    value: '18:00',
                    width: 80
                });
                var affirm_date = new Ext.form.DateField({
                    //fieldLabel: 'COF',
                    name: 'affirm_date',
                    format: 'Y-m-d', //格式化日期
                    //disabledDays: [0,6],	//不让选择周六，周日
                    //disabledDaysText: "周末要休息",
                    invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
                    allowBlank: false,
                    blankText: "确认日期必须选择",
                    //emptyText: '请选择...',
                    inputType: '2008-01-01',
                    //anchor: '50%'
                    width: 90,
                    applyTo: 'affirm_date',
                    minValue: today,
                    value: today
                });
                var send_date = new Ext.form.DateField({
                    //fieldLabel: '送票日期',
                    name: 'send_date',
                    altFormats: 'Y-m-d',
                    format: 'Y-m-d', //格式化日期
                    //disabledDays: [0,6],	//不让选择周六，周日
                    //disabledDaysText: "周末要休息",
                    invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
                    allowBlank: true,
                    //emptyText: '请选择...',
                    inputType: '2008-01-01',
                    applyTo: 'send_date',
                    editable: false,
                    minValue: today,
                    //anchor: '50%'
                    width: 90
                });
                var send_time = new Ext.form.TimeField({
                    //fieldLabel: '送票时间',
                    name: 'send_time',
                    altFormats: 'H:i',
                    format: 'H:i',
                    increment: 30,
                    minValue: '06:00',
                    maxValue: '22:00',
                    applyTo: 'send_time',
                    editable: false,
                    //anchor: '50%'
                    width: 80
                });
                var jj_time = new Ext.form.TimeField({
                    //fieldLabel: '接机时间',
                    name: 'jj_time',
                    altFormats: 'H:i',
                    format: 'H:i',
                    increment: 30,
                    minValue: '06:00',
                    maxValue: '22:00',
                    applyTo: 'jj_time',
                    editable: false,
                    //anchor: '50%'
                    width: 80
                });
                var owner = new Ext.form.ComboBox({
                    store: new Ext.data.Store({
                        proxy: new Ext.data.HttpProxy({
                            url: '/users/getAllUsersComboBox'
                        }),
                        reader: new Ext.data.JsonReader({
                            root: 'root'
                        }, [{
                            name: 'id'
                        }, {
                            name: 'user_name'
                        }])
                    }),
                    resiable: true,
                    typeAhead: true,
                    fieldLabel: '所有者',
                    name: 'owner',
                    loadingText: '正在加载...',
                    displayField: 'user_name',
                    valueField: 'id',
                    mode: 'remote',
                    //hideTrigger: true,
                    triggerAction: 'all',
                    //hiddenName: 'owner',//如果不想提交displayField，则在这儿指定以提交ID的值．
                    //hiddenId:'owner',
                    emptyText: '',
                    allowBlank: true,
                    applyTo: 'owner',
                    editable: false,
                    //forceSelection: false,
                    width: 90,
                    //maxHeight: 150,
                    tabIndex: 4,
                    onSelect: function(record){
                        //alert(record.data.user_name);
                        owner.setValue(record.data.user_name);
                        if (this.isExpanded()) {
                            this.collapse();
                        }
                    }
                });
                //送票地址关键字搜索
                var address_resultTpl = new Ext.XTemplate('<tpl for="."><div class="search-item">', '<h3>{address}</h3>', '</div></tpl>');
                var send_address = new Ext.form.ComboBox({
                    store: new Ext.data.Store({
                        proxy: new Ext.data.HttpProxy({
                            url: '/customers/getAddressComboBox?id=' + addMul_cid
                        }),
                        reader: new Ext.data.JsonReader({
                            root: 'root'
                        }, [{
                            name: 'address'
                        }])
                    }),
                    //fieldLabel: '送票地址',
                    name: 'send_address',
                    allowBlank: true,
                    //blankText: "送票地址不允许为空",
                    anchor: '90%',
                    value: customer_address,
                    displayField: 'title',
                    typeAhead: false,
                    loadingText: '正在查找...',
                    //width: 250,
                    hideTrigger: false,
                    tpl: address_resultTpl,
                    //transform: 'send_address_el',
                    applyTo: 'send_address',
                    minChars: 4,
                    itemSelector: 'div.search-item',
                    onSelect: function(record){
                        //alert(record.data.address);
                        send_address.setValue(record.data.address);
                        if (this.isExpanded()) {
                            this.collapse();
                        }
                    }
                });
                //乘机人姓名关键字搜索
                var applyToName = "pass_name";
                var applyToDate = "chd_date";
                var pass_resultTpl = new Ext.XTemplate('<tpl for="."><div class="search-item">', '<h3>{name}</h3>', '</div></tpl>');
                for (i = 0; i < 9; i++) {
                    if (i > 0) {
                        applyToName = "pass_name" + i;
                    }
                    new Ext.form.ComboBox({
                        store: new Ext.data.Store({
                            proxy: new Ext.data.HttpProxy({
                                url: "/customers/getPassengerComboBox"
                            }),
                            reader: new Ext.data.JsonReader({
                                root: 'root'
                            }, [{
                                name: 'id'
                            }, {
                                name: 'name'
                            }, {
                                name: 'phone'
                            }, {
                                name: 'card'
                            }])
                        }),
                        //fieldLabel: '乘客姓名',
                        //name: 'passenger_name'+i,
                        allowBlank: false,
                        blankText: "乘客姓名不允许为空",
                        //displayField: 'title',
                        typeAhead: false,
                        loadingText: '正在查找...',
                        width: 100,
                        //anchor: '100%',
                        //hideTrigger: true,
                        tpl: pass_resultTpl,
                        //transform: 'passenger_name_el',
                        applyTo: applyToName,
                        minChars: 0,
                        itemSelector: 'div.search-item',
                        onSelect: onSelectFunc
                    });
                    if (i > 0) {
                        applyToDate = "chd_date" + i;
                    }
                    new Ext.form.DateField({
                        //fieldLabel: '出生日期',
                        //name: applyToDate,
                        altFormats: 'Y-m-d',
                        format: 'Y-m-d', //格式化日期
                        //disabledDays: [0,6],	//不让选择周六，周日
                        //disabledDaysText: "周末要休息",
                        invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
                        allowBlank: true,
                        blankText: '出生日期必须选择',
                        //emptyText: '请选择...',
                        inputType: '2008-01-01',
                        applyTo: applyToDate,
                        editable: false,
                        //anchor: '50%'
                        width: 90
                    });
                }
                function onSelectFunc(record){
                    var id = this.el.id;
                    if (id == "pass_name") {
                        $("pass_name").value = record.data.name;
                        $("pass_idcard").value = record.data.card;
                        $("pass_tel").value = record.data.phone;
                    }
                    else {
                        key = id.substring(9);
                        $("pass_name" + key).value = record.data.name;
                        $("pass_idcard" + key).value = record.data.card;
                        $("pass_tel" + key).value = record.data.phone;
                    }
                    if (this.isExpanded()) {
                        this.collapse();
                    }
                }
            })
        </script>
    </body>
</html>
